import {lsHttp} from "../utils/lshttp";

// 获取订单列表
export const getOrderListsAPI = ({status, page, limit}) => {
    return lsHttp({
        url: '/api/order/lists',
        method: 'POST',
        data: {
            status: status === '-1' ? 'all' : status,
            page: page,
            limit: limit,
        }
    }, false)
}
// 获取订单列表+官返订单列表
export const getOrderGFListsAPI = ({status, page, limit}) => {
    return lsHttp({
        url: '/api/order/Mtlists',
        method: 'POST',
        data: {
            status: status === '-1' ? 'all' : status,
            page: page,
            limit: limit,
        }
    }, false)
}
// 取消订单
export const getCancelAPI = (parent_id) => {
    return lsHttp({
        url: '/api/order/cancel',
        method: 'POST',
        data: {
            parent_id
        }
    })
}

// 上传订单号
export const uploadOrderIdAPI = (order_id, user_pay_order_no,) => {
    return lsHttp({
        url: '/api/order/uploadOrderId',
        method: 'POST',
        data: {
            order_id, user_pay_order_no
        }
    })
}

// 不需要品鉴也不需要订单截图时的上传凭证
export const submitOrderCheckAPI = (parent_id) => {
    return lsHttp({
        url: '/api/order/submitOrderCheck',
        method: 'POST',
        data: {
            parent_id
        }
    })
}

// 抢单
// shop_activity_id	是	int	店铺活动ID
// is_new	否	int	2.3版本后抢单传1
// client	否	string	2.3版本后用户客户端：H5,安卓APP,苹果APP,小程序
export const doOrderAPI = (shop_activity_id, addressDel, red_id = 0, card_id = 0) => {
    return lsHttp({
        url: '/api/order/doOrder',
        method: 'POST',
        data: {
            shop_activity_id, ...addressDel, is_new: 1, red_id, card_id
        }
    })
}

// 官返抢单
export const doGFOrderAPI = (data, address) => {
    return lsHttp({
        url: '/api/mtOrder/applyOrder',
        method: 'POST',
        data: {
            ...data,
            ...address
        }
    })
}
// 取消订单
export const cancelOrderAPI = (order_id) => {
    return lsHttp({
        url: '/api/order/cancel',
        method: 'POST',
        data: {
            order_id
        }
    })
}
// 订单详情
export const orderDetailsAPI = (order_id, lat, lng) => {
    return lsHttp({
        url: '/api/order/details',
        method: 'POST',
        data: {
            order_id,
            lat,
            lng,
        }
    })
}
// 评鉴提交检查
export const submitOrderAPI = (data) => {
    return lsHttp({
        url: '/api/order/submitOrderCheck',
        method: 'POST',
        data: data
    })
}
// 评鉴提交检查
export const checkOrderPicAPI = (data) => {
    return lsHttp({
        url: '/api/order/checkOrderPic',
        method: 'POST',
        data: data
    })
}

// 恢复订单
export const resumeOrderAPI = (order_id) => {
    return lsHttp({
        url: '/api/order/resume',
        method: 'POST',
        data: {order_id}
    })
}

// 取消官返订单
export const cancelGFOrderAPI = (userEventId, channel_id) => {
    return lsHttp({
        url: '/api/mtOrder/cancelOrder',
        method: 'POST',
        data: {userEventId, channel_id}
    })
}

// 查询官返订单状态
export const queryGFOrderStateAPI = (userEventId) => {
    return lsHttp({
        url: '/api/mtOrder/eventProgress',
        method: 'POST',
        data: {userEventId}
    })
}

// 获取所有订单
export const linkOrderAPI = () => {
    return lsHttp({
        url: '/api/userFeedback/linkOrder',
        method: 'POST'
    })
}

//判断店铺是否审核，并给出提示API
export const getRemarkAPI = () => {
    return lsHttp({
        url: '/api/ShopActivityRemark/getRemark',
        method: 'POST',
    })
}

// 获取订单进程数据
export const getOrderProcessAPI = (order_id, order_type) => {
    return lsHttp({
        url: '/api/order/getOrderLog',
        method: 'POST',
        data: {order_id, order_type}
    })
}

// 删除已取消订单
export const deleteOrderAPI = (order_id) => {
    return lsHttp({
        url: '/api/order/del',
        method: 'POST',
        data: {order_id}
    })
}
// 官返删除已取消订单
export const deleteGFOrderAPI = (order_id) => {
    return lsHttp({
        url: '/api/mtOrder/del',
        method: 'POST',
        data: {order_id}
    })
}

// 一键催审
export const oneKeyCuiShenAPI = (order_id) => {
    return lsHttp({
        url: '/api/order/insertOrder',
        method: 'POST',
        data: {order_id}
    })
}